<?php
/* @var $this GadgetController */
/* @var $model Gadget */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'gadget-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'categoryId'); ?>
		<?php 
		// echo $form->textField($model,'categoryId'); ?
		echo CHtml::dropDownList('categoryId', $model->categoryId,   Gadgetcategory::model()->listDataCat(), array('empty' => '(Select a category)'));
		?>
		<?php echo $form->error($model,'categoryId'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textField($model,'description',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'description'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'isActive'); ?>
		<?php //echo $form->textField($model,'isActive'); ?>
		<?php echo $form->checkBox($model,'isActive'); ?>
		<?php echo $form->error($model,'isActive'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array(
			'class'=>'btn btn-success'
		)); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->

<?php
if($model->isNewRecord){

}else{
?>

<hr>

<h1>
	Update Image gadget
</h1>
<br>
<div class="row">
	
	<?php
	$this->widget('ext.imageSelect.ImageSelect',  array(
        'path'=>Yii::app()->request->baseUrl.'/uploads/products/'.$model->imageUrl,
        'alt'=>'',
        'uploadUrl'=>Yii::app()->createUrl('admin/product/upload',array('id'=>$model->id)),
        'htmlOptions'=>array('style'=>'height: 300px')
    ));
	?>
	</div>
<?php
}
?>



<?php
if($model->isNewRecord){

}else{
?>
<hr>
<br>
<h1>
	Update Quote
</h1>
<div class="row">
<?php
	if(!empty($Gadgetcondition)){
	?>
	<form id="frmQuote" name="frmQuote" method="post" action="<?php echo Yii::app()->createUrl('/admin/product/updateQuote',array('id'=>$model->id));?>">
	<?php
		foreach($Gadgetcondition as $key=>$value){
			$price = $value->getQuote($value->id,$model->id);
			
?>
	<div class="span12">
		<label ><?php echo $value->name;?></label>
		<input type="text" name="Quote[<?php echo $value->id;?>]" value="<?php echo $price;?>"> $
	</div>
<?php
		}
?>
		<div class="span12 buttons">
			<input class="btn btn-success" type="submit" name="yt1" value="Save quote">
			
		</div>
	</form>
<?php
	}
?>
</div>
<?php
}
?>


<br>
